<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>

<head>
<title>Constants - Macros</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../../styles/styles.css">
</head>

<body>

<h1>Constants</h1>
<div class="navbar">
<a href="../../index.html">main</a> |
<a href="../index.html">Macros</a> |
<a href="index.html">Macro-language</a>
</div>

<div class=shortdescr>
You can use the constants to store values associated with the names and use them later in the macro sequences.
</div>

<h3>Naming</h3>
<div class=descr>
<p>Names of the constants should comply with these rules:
<ol>
<li>Name should begin from the english letter, and can contain in arbitrary order english letters, digits, and '_' symbol.
<li>Name should not coincide with predefined <a href="boolstate.html">boolean states</a>, <a href="functions.html">macro functions names</a>, names of the keys, and other <a href="states.html">macro states</a>.
</ol>
<p>
</div>

<h3>Types</h3>
<div class=descr>
<p>Constants can be either string or integer.
<p>Integer constants can be represented by: NNN - decimal constant, 0NNN - octal constant, 0xNNN - hexadecimal constant.
<p>Integers are of 64 bit width.
</div>


<h3>Area of effect</h3>
<div class=descr>
<p>The scope for the constants is a current FAR Manager session.
</div>

<h3>Representation in registry</h3>
<div class=descr>
<p>In the registry, constants are stored in the special key <code>[HKEY_CURRENT_USER\Software\Far\[Users\USERNAME\]KeyMacros\Consts]</code>.
<p>Every constant has a name and can be of three types REG_SZ (for string constants) and REG_DWORD or REG_QDWORD (for integer constants).
</div>

<h3>Remarks</h3>
<div class=descr>
<ol>
<li>It is impossible to use macro-language elements while <a href="../macrokey/record.html">recording</a>
  a macro in a usual way. Macro-language elements can be added to the sequence only by editing
  the registry manually or by using special applications or FAR plugins.</li>
</ol>
</div>

<h3>Example</h3>
<div class=descr>
Example of using FIB_PASSWORD constant (0x00000002) for <a href="functions.html#prompt">prompt</a> function
<pre class=code>REGEDIT

[HKEY_CURRENT_USER\Software\Far\KeyMacros\Consts]
"FIB_PASSWORD"=dword:00000002

[HKEY_CURRENT_USER\Software\Far\KeyMacros\Editor\CtrlP]
"Sequence"="%s=prompt(\"Password\",\"Input password:\",FIB_PASSWORD); $Text %s"
"DisableOutput"=dword:00000001
</pre>
</div>

<div class=see>See also:</div><div class=seecont>
</div>

</body>

</html>
